<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<script type="text/javascript">
   $(function(){
/*$(".updatenews").each(function(){
    	   
    	   var mid ="#"+ $(this).attr("mid");
    	   alert(mid);
    	  $(this).click(function(){
    		  alert("122");
    		  $(mid).model();
    	  }) ;
       });
       $(".editor").each(function(){
       		var eid = $(this).attr("id");
       		var iid ="#" + $(this).attr("iid");
       		 var ue = UE.getEditor(eid);
       		 var content = $(iid).val();
       		 alert(iid);
       		 alert(content);
       		 ue.setContent(content);
       });
       */
 
   });
	function shaixuan()/*新闻筛选函数*/
	{
		var word=document.getElementById('appendedInputButton').value;
window.location.href = '<c:url value="/admin/news_shaixuan/1"/>?words='+ word;
	}
	function del()/*新闻删除确认函数*/
	{
		if (confirm('您确定要删除该条新闻？'))
			return true;
		else
			return false;
	}


	function searchByType()//新闻种类下拉列表的OnChange事件处理函数*/
	{
		var type = document.getElementById('kind').value;
		window.location.href = "<c:url value='/ShaiXuan_News'/>?type="+type;
	}	
</script>
	<div class="border_color  title_color">
	<h3>新闻管理</h3>
</div>

	<div class='row'>
		<div class="col-sm-6 input-group" style='margin-bottom:10px;'>
                 <span class="input-group-addon">类型</span>
                  <select class="form-control" id='nbkind' name='bn'>
                     <option value='news'>新闻</option>
                     <option value="bulletin">公告</option>
                  </select>
       </div>
    <br><br>
			<div class='col-md-12' style='margin-left:0px;margin-top:10px;'>
			<div id="newses" class='col-md-12' style='margin-left:0px;'>
			  <table style="width: 100%" class="table table-hover ">
			  
				<c:choose>
					<c:when test="${empty newses }">
						<tr>
							<td colspan="3" style="color: red" align="center">暂时没有新闻。可<a href='<%=basePath %>backend/addnewsui'>添加</a></td>
						</tr>
					</c:when>
					<c:when test="${not empty newses}">
					    <tr>
					       <td  class='content_td1'>标题</td>
					      
					       <td  class='content_td3'>操作</td>
					    </tr>
						<c:forEach items="${newses }" var="news" varStatus="status">
							<tr class='discuss'>
								<td class="content_td1 ">
								    <a
									href="<%=basePath %>backend/newsdetail/${news.id }" title='${news.title}'>
									<span class='newsTitle1'>${news.title}</span>
									</a>
								</td>
								<td class="content_td3"><a href='#'><button te='${news.id }' class='delete btn btn-danger'>删除</button></a>
								  |	<a href='<%=basePath %>backend/updatenewui/${news.id }' class="updatenews btn btn-primary btn-lg"  >
                                                                                          修改
                                   </a>
                                   <!-- Modal -->
                          
								</td>
						</c:forEach>
						<input value="${newsesCount }" id="newsesCount" type="hidden"/>
					</c:when>
				</c:choose>
			
			  </table>
			  <div id="pageDir"  style='margin-top:5px;margin-left:200px;'></div>
			  </div>
			<div id="bulletins" class='col-md-12' style='margin-left:0px;'>
			<table  style="width: 100%"  class="table table-hover ">
			
				<c:choose>
					<c:when test="${bulletins==null }">
						<tr class='r1'>
							<td colspan="3" align="center">暂时没有公告。可<a href='<%=basePath %>backend/addnewsui'>添加</a></td>
						</tr>
					</c:when>
					<c:when test="${bulletins!=null }">
					    <tr class='r1'>
					       <td >标题</td>
					       <td >归属</td>
					       <td >操作</td>
					    </tr>
						<c:forEach items="${bulletins }" var="news" varStatus="status">
							<tr class='r1 discuss1'>
								<td class="content_td1">
								    <a
									href="<%=basePath %>backend/newsdetail/${news.id }" title='${news.title}'>
									<span class='newsTitle2'>${news.title}</span>
									</a>
								</td>
								<td class="content_td2"></td>
								
								<td class="content_td3"><a href='#'><input te='${news.id }' class='delete btn btn-danger' value='删除'/></a>
								  |	<a href='<%=basePath %>backend/updatenewui/${news.id }' class='btn btn-info' >
                                                                                          修改
                                   </a>
                                   <!-- Modal -->
								</td>
								</tr>
						</c:forEach>
						<input value="${bulletinsCount }" id="bulletinsCount" type="hidden"/> 				
					</c:when>
				</c:choose>
			</table>
			<div id="pageDir1" style='margin-top:5px;margin-left:200px;'></div> 
			</div>
			</div>
	</div>
